Skip to content

feat: add GET /run/list endpoint (#39)#279

Open
saathviksheerla wants to merge 2 commits intoopenml:mainfrom
saathviksheerla:feat/run-list-endpoint
Open

feat: add GET /run/list endpoint (#39)#279
saathviksheerla wants to merge 2 commits intoopenml:mainfrom
saathviksheerla:feat/run-list-endpoint

Conversation

@saathviksheerla
Copy link
Contributor

Description

Adds the GET /run/list and POST /run/list endpoints for listing runs with optional filters.

Fixes: #39

Filters supported (all optional, combinable with AND logic):

  • run_id — list of run IDs
  • task_id — list of task IDs
  • flow_id — list of flow IDs
  • setup_id — list of setup IDs
  • uploader — list of user IDs
  • tag — single tag string (validated via SystemString64)

Pagination is supported via the nested pagination body parameter (consistent with other list endpoints).

Returns 404 with code 372 when no runs match the filters.

Deviation from PHP: The PHP API requires at least one filter (error 510). This endpoint follows the pattern of other list endpoints in this API and allows no-filter requests, returning all runs paginated.

Checklist

  • I have performed a self-review of my own pull request to ensure it contains all relevant information, and the proposed changes are minimal but sufficient to accomplish their task.
  • Tests pass locally
  • I have commented my code in hard-to-understand areas, and provided or updated docstrings as needed
  • I have added tests that cover the changes (only required if not already under coverage)

@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

❌ Patch coverage is 32.50000% with 27 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@c9ada15). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/routers/openml/runs.py 31.57% 26 Missing ⚠️
src/main.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #279   +/-   ##
=======================================
  Coverage        ?   53.31%           
=======================================
  Files           ?       35           
  Lines           ?     1525           
  Branches        ?      131           
=======================================
  Hits            ?      813           
  Misses          ?      710           
  Partials        ?        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@saathviksheerla saathviksheerla marked this pull request as ready for review March 18, 2026 04:37
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 3490d114-99c9-444d-8732-a53379158079

📥 Commits

Reviewing files that changed from the base of the PR and between 42bc467 and 366f273.

📒 Files selected for processing (1)
  • src/routers/openml/runs.py

Walkthrough

Adds a new OpenML runs router and registers it with the FastAPI app. Introduces a /run/list endpoint (GET and POST) that accepts optional filters: run_id, task_id, flow_id, setup_id, uploader, and tag, and supports pagination via limit/offset. Implements dynamic SQL filtering and tag subquery handling. Adds comprehensive tests covering filtering, pagination, error responses, and field validation.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a GET /run/list endpoint with optional filters.
Description check ✅ Passed The description comprehensively details the endpoint functionality, supported filters, pagination, error handling, and deviations from the PHP API.
Linked Issues check ✅ Passed The PR successfully implements the GET /run/list endpoint with optional filters as required by issue #39, meeting all coding requirements.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the /run/list endpoint; no extraneous modifications were introduced.
Docstring Coverage ✅ Passed Docstring coverage is 96.67% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Using a request body (Body) for the GET /run/list parameters (including pagination) can be problematic for standard HTTP clients and tooling; consider using query parameters for the GET variant and keeping the body-based interface only for POST /run/list, while still sharing the same handler logic.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Using a request body (Body) for the GET /run/list parameters (including pagination) can be problematic for standard HTTP clients and tooling; consider using query parameters for the GET variant and keeping the body-based interface only for POST /run/list, while still sharing the same handler logic.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/routers/openml/runs.py (1)

107-124: Consider adding ORDER BY for deterministic pagination.

The query lacks an ORDER BY clause, which means pagination results could be inconsistent across requests (same offset may return different rows). Adding ORDER BY r.rid would ensure stable, predictable pagination.

♻️ Proposed fix
         FROM run r
         JOIN algorithm_setup a ON r.setup = a.sid
         {where_clause}
+        ORDER BY r.rid
         LIMIT :limit OFFSET :offset
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/routers/openml/runs.py` around lines 107 - 124, The SQL constructed in
the variable query in runs.py uses LIMIT/OFFSET without an ORDER BY, causing
non-deterministic pagination; update the text(...) SQL to include a
deterministic ORDER BY clause (e.g., ORDER BY r.rid) placed before the LIMIT
:limit OFFSET :offset so that queries built with where_clause and the query
variable return stable, repeatable pages for functions that rely on run_id
ordering.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/routers/openml/runs.py`:
- Around line 107-124: The SQL constructed in the variable query in runs.py uses
LIMIT/OFFSET without an ORDER BY, causing non-deterministic pagination; update
the text(...) SQL to include a deterministic ORDER BY clause (e.g., ORDER BY
r.rid) placed before the LIMIT :limit OFFSET :offset so that queries built with
where_clause and the query variable return stable, repeatable pages for
functions that rely on run_id ordering.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 215d38de-d419-460b-92fe-fa8de6ea3b0b

📥 Commits

Reviewing files that changed from the base of the PR and between 5357b01 and 42bc467.

📒 Files selected for processing (3)
  • src/main.py
  • src/routers/openml/runs.py
  • tests/routers/openml/runs_list_test.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GET /run/list/{filters}

1 participant